<?php
/*
 +----------------------------------------------------------------------
 + Title        : WebApiLog 控制器
 + Author       : Randy_chen
 + Version      : V1.0.0.1
 + Initial-Time : 2019/8/19 10:24
 + Last-time    : 2019/8/19 10:24+ 86187
 + Desc         : WebApiLog
 +----------------------------------------------------------------------
*/


namespace app\admin\controller;


use app\common\lib\Where;
use library\Controller;

/**
 * WEB接口日志
 * Class WebApiLog
 *
 * @package app\api\controller
 */
class WebApiLog extends Controller
{
    protected $table = 'web_api_log';
    /**
     * web接口日志管理
     *
     * @auth true
     * @menu true
     */
    public function index()
    {
        $this->title = 'web接口日志管理';
        if ($this->request->post()) {
            $where = new Where();
            $model = model('common/WebApiLog');
            $res = $model->whereParse($where->equal('url,channel_id')->dateBetween('create_time'))->order('id desc')->paginate(input('limit'));
            $this->success('查询成功!', $res);
            exit;
        } else {
            $this->applyCsrfToken();
            return $this->fetch();
        }
    }

    /**
     * web接口日志详情
     *
     * @auth true
     * @menu true
     */
    public function detail(){
        $id = $this->request->param('id');
        $info = db($this->table)->find($id);
        $this->assign('info' , $info);
        return $this->fetch();
    }

}